package com.at.abc.r421_e;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;

public class a {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(System.out);
        int n = Integer.parseInt(br.readLine());
        String[] s = new String[n];
        for (int i = 0; i < n; i++) {
            s[i] = br.readLine();
        }
        String[] in = br.readLine().split(" ");
        int x = Integer.parseInt(in[0]);
        String y =in[1];
        if (s[x - 1].equals(y)) {
            out.println("Yes");
        } else {
            out.println("No");
        }

        out.flush();
        out.close();
        br.close();
    }
}
